const initState = {
    count: 0,
    num: 0,
    total: 0
};
const PROJECT_NAME = "reduxStatus"
// redux状态
export const SORT_BASE_SET = {
    from:`reduxStatus`,
    redux:`reduxStatus`
}

export const updataCountType = `${PROJECT_NAME}/updataCount`;
export const updataNumType = `${PROJECT_NAME}/updataNum`;

export default (state = initState, action) => {
    switch (action.type) {
        case updataCountType:
            return {
                ...state,
                count: action.count,
                total: state.num * 1 * action.count,
            };
        case updataNumType:
            return {
                ...state,
                num: action.num,
                total: state.count * 1 * action.num,
            };
        default:
            return {
                ...state
            };
    }
}